using System.Collections;
using GameKit.Core;
using GameKitUnity.Core;
using GameKitUnity.UI;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
using Logger = GameKitUnity.Logger;

namespace GameKitUnityTest
{
    public class Test_UIKit
    {
        const string TaskPanel = "Assets/1Game/Prefabs/UI/TaskPanel.prefab";

        [SetUp]
        public void Init()
        {
            SceneManager.LoadScene("Test Scene");
            UIKit.Instance.SetAssetLoader(AssetLoader.Instance);
            Log.SetLogger(new Logger());
        }

        [UnityTest]
        public IEnumerator Test1()
        {
            UIKit.Instance.OpenPanel(this, TaskPanel, panel => { Log.Info($"Panel {panel.Name} opened"); });
            yield return new WaitForSeconds(10);
        }

        [UnityTest]
        public IEnumerator Test2()
        {
            _ = UIKit.Instance.OpenPanelAsync(this, TaskPanel);
            Log.Info("Panel async opened");
            yield return new WaitForSeconds(10);
        }
    }
}